// pages/myOrder/myOrder.js
Page({
  data: {
    // 订单列表数据
    orderList: [{
        'orderNum': 'RH18245269458112',
        'roomCode': '8106',
        'checkInDate': '2018-04-02',
        'checkOutDate': '2018-04-03',
        'orderPrice': '528',
        'roomType': '睿沃智慧大床房'
      },
      {
        'orderNum': 'RH18254887441455',
        'roomCode': '8202',
        'checkInDate': '2018-03-28',
        'checkOutDate': '2018-03-20',
        'orderPrice': '1056',
        'roomType': '睿沃智慧双床房'
      },
      {
        'orderNum': 'RH182874596220001',
        'roomCode': '8316',
        'checkInDate': '2018-03-15',
        'checkOutDate': '2018-03-16',
        'orderPrice': '738',
        'roomType': '智趣套房'
      },
      {
        'orderNum': 'RH182451263211287',
        'roomCode': '8203',
        'checkInDate': '2018-02-28',
        'checkOutDate': '2018-03-01',
        'orderPrice': '528',
        'roomType': '睿沃智慧大床房'
      },
    ],
    isActive: true,
  },
  onLoad: function (option) {

  },
  onShow: function () {

  },
  orderDel(e) {
    console.log(e);
    let index = e.currentTarget.dataset.index
    let _list = this.data.orderList

    wx.showModal({
      cancelColor: 'cancelColor',
      title: '确定要删除吗',
      success: ((res) => {
        if (res.confirm) {
          _list.splice(index, 1)
          this.setData({
            orderList: _list
          })
        }
      })
    })

  },
  changeActive(e) {
    this.setData({
      isActive: e.target.dataset.active
    })
  }

})